﻿Vue.component("my-menu",
    {
        template: [
            `<div id="head-app">
              <el-row :gutter="20">
                <el-col :span="2">
                    <img style="margin-top: 17px;" src="http://tccommon.17usoft.com/oauth/resources/img/logo_new_year.png" alt="常规" >
                </el-col>
                <el-col :span="16" :offset="2" >
                <el-menu  theme="dark"   default-active="model" class ="el-menu-demo" mode="horizontal" @select="handleSelect"  style="margin-top: 15px;">
                    <el-menu-item v-for="item in menus"  :index="item.id" > {{item.name}}</el-menu-item>
                </el-menu>
               </el-col>
              </el-row>
            </div>`
        ].join(""),
        props: ["model"],
        data: function () {
            return {
                menus:
                    [

                        //{
                        //    id: "1",
                        //    name: "",
                        //    url: "./index",
                        //},
                        {
                            id: "2",
                            name: "我的问卷",
                            url: "../Mypaper.aspx",
                        },
                        //{
                        //    id: "3",
                        //    name: "表单提交",
                        //    url: "./demo",
                        //},
                    ],
            };
        },

        methods: {
            handleSelect(key, keyPath) {
                var that = this;
                var obj = {};
                that.menus.map(function (item) {
                    if (item.id === key) {
                        window.location.href = item.url;
                        that.selectId = item.id;
                    }
                });
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            }
        },

        ready: function () {

        }
    });